Ejemplo n.º 1
0
    def test_GCPSession_error(self):
        try:
            GCPSlaveDescriptor(addr_master='localhost',
                               port_master=None,
                               interface_local="lo",
                               addr_family=socket.AF_INET6)
        except Exception as e:
            self.assertIsInstance(e, GCPSlaveSessionError)

        desc = GCPSlaveDescriptor(addr_master='localhost',
                                  port_master=60001,
                                  interface_local="lo",
                                  addr_family=socket.AF_INET)
        self.assertEqual(desc.get_uniq_id(), desc.uniq_id)
        self.assertEqual(desc.get_node_type(),
                         GCPSessionDescriptor.NODE_TYPE_SLAVE)

        session = GCPSession(desc)
        self.assertEqual(-1, session.get_socket_fd())

        self.assertEqual(session.get_sock_string(None), "Socket_None")
        self.assertEqual(session.get_sock_string("test"),
                         "{}:{} --> {}:{}".format(None, None, None, None))

        session.session_state = GCPSession.SESSION_STATE_FAILED
        try:
            session.initiate()
        except Exception as e:
            self.assertIsInstance(e, GCPSessionError)

        session.reinit()
        self.assertEqual(session.session_state, GCPSession.SESSION_STATE_INIT)

        session.initiate()
        self.assertTrue(session.is_started())
        self.assertTrue(session.is_initiated())

        try:
            session.read_pkt(0)
        except Exception as e:
            self.assertEqual(1, session.stats.RxSessionErr)
            self.assertIsInstance(e, GCPSessionError)

        try:
            session.send_pkt(0)
        except Exception as e:
            self.assertEqual(1, session.stats.TxSessionErr)
            self.assertIsInstance(e, GCPSessionError)

        session.close()
Ejemplo n.º 2
0
    def add_ccap_cores(self,
                       ccap_cores,
                       port_master=GCPSessionDescriptor.DEFAULT_PORT_MASTER):
        """Create GCP descriptors based on addresses of CCAP cores received
        from DHCP server to orchestrator.

        :param ccap_cores: list of "interface;core ip"
        :type ccap_cores: list(string)
        :return:

        """
        descriptors = []

        for core_addr in ccap_cores:
            interface, core = core_addr.split(';')
            if not Convert.is_valid_ip_address(core):
                self.logger.warn("Malformed IP address received: %s", core)
                continue

            is_ipv6 = Convert.is_valid_ipv6_address(core)
            family = (AF_INET, AF_INET6)[is_ipv6]
            addr_local = SysTools.get_ip_address(str(interface), family)
            # TODO pass also local address to use specific interface
            descriptors.append(
                GCPSlaveDescriptor(core,
                                   port_master=port_master,
                                   addr_local=addr_local,
                                   interface_local=interface,
                                   addr_family=family))
        self.orchestrator.add_sessions(descriptors)
Ejemplo n.º 3
0
    def test_get_cfg(self):
        print "test_get_cfg\n"
        timeOut = time.time() + 10
        while self.hal_ipc is not None and self.hal_ipc.disconnected and time.time(
        ) < timeOut:
            pass

        desc = GCPSlaveDescriptor("127.0.0.1",
                                  port_master=9999,
                                  addr_local="127.0.0.1",
                                  interface_local="lo",
                                  addr_family=socket.AF_INET)
        dummy_session = RCPSlaveSession(desc, self.dispatcher, self.fake_cb,
                                        self.fake_cb, self.fake_cb)

        ipc_msg = {
            'session': dummy_session,
            'req_packet': "dummy-packet",
            'gcp_msg': "dummy-message",
            'req_data': [
                create_cfg_read_sequence(),
            ],
        }
        if None is not self.hal_ipc:
            self.hal_ipc.rcp_cfg_req(ipc_msg)
        else:
            print("test_get_cfg: self.hal_ipc is None!")
        time.sleep(5)
Ejemplo n.º 4
0
    def setUpClass(cls):
        setup_logging("GCP", filename="rcp.log")

        cls.dispatcher = Dispatcher()
        cls.desc = GCPSlaveDescriptor(addr_master='localhost',
                                      interface_local='local')
        cls.session = RCPSlaveSession(cls.desc, cls.dispatcher, fake_cb,
                                      fake_cb, fake_cb)
Ejemplo n.º 5
0
 def setUpClass(cls):
     create_db_conf()
     start_redis()
     RCPDB.DB_CFG_FILE = CONF_FILE
     cls.dispatcher = Dispatcher()
     cls.desc = GCPSlaveDescriptor(addr_master='localhost',
                                   interface_local='local')
     cls.session = RCPSlaveSession(cls.desc, cls.dispatcher, fake_cb,
                                   fake_cb, fake_cb)
Ejemplo n.º 6
0
 def setup_slave(cls):
     print "setup slave"
     cls.slave_orchestrator = RCPSlaveOrchestrator(
         disp=cls.slave_disp,
         cfg_ipc_channel=cls.RcpProcessChannel(),
         reboot_cb=None)
     cls.slave_desc = GCPSlaveDescriptor(core_ip,
                                         port_master=local_port,
                                         addr_local=local_ip,
                                         interface_local=local_interface,
                                         addr_family=addr_family)
     cls.slave_thread = threading.Thread(target=cls.slave_disp.loop)
     cls.slave_thread.start()
Ejemplo n.º 7
0
    def test_send_vsp_tlv_to_drv(self):
        """
        Send 2 RCP Sequences: 1 with READ, 1 with WRITE
        """
        print "test_send_vsp_tlv_to_drv\n"

        timeOut = time.time() + 5
        while self.hal_ipc is not None and self.hal_ipc.disconnected and time.time(
        ) < timeOut:
            pass

        desc = GCPSlaveDescriptor("127.0.0.1",
                                  port_master=9999,
                                  addr_local="127.0.0.1",
                                  interface_local="lo",
                                  addr_family=socket.AF_INET)
        dummy_session = RCPSlaveSession(desc, self.dispatcher, self.fake_cb,
                                        self.fake_cb, self.fake_cb)

        ipc_msg = {
            'session':
            dummy_session,
            'req_packet':
            "dummy-packet",
            'gcp_msg':
            "dummy-message",
            'req_data': [
                self.vsp_tlv_seq.create_vendor_tlvs_sequence(
                    gcp_msg_def.NotifyREQ, rcp_tlv_def.RCP_MSG_TYPE_NTF,
                    rcp_tlv_def.RCP_OPERATION_TYPE_READ),
                self.vsp_tlv_seq.create_vendor_tlvs_sequence(
                    gcp_msg_def.NotifyREQ, rcp_tlv_def.RCP_MSG_TYPE_NTF,
                    rcp_tlv_def.RCP_OPERATION_TYPE_WRITE),
            ],
        }
        if None is not self.hal_ipc:
            self.hal_ipc.rcp_cfg_req(ipc_msg)

        time.sleep(1)
        pkt_db = self.hal_ipc.msg_record.pkt_db
        pkt_db_len = len(pkt_db)

        # since the seq contains matched vendor id, so all RCP sequences should be sent to driver
        self.assertTrue(pkt_db_len == 0)
Ejemplo n.º 8
0
    def test_slave_init_close(self):
        # need to start master first
        desc = GCPMasterDescriptor(addr=None, port=60001)
        self.master = GCPMaster(session_descriptor=desc)
        self.master.initiate()
        self.assertTrue(self.master.is_initiated())

        # create slave
        desc = GCPSlaveDescriptor(addr_master='localhost', port_master=60001)
        slave = GCPSlaveSession(desc)
        self.assertFalse(slave.is_initiated())

        # start master working thread
        t = threading.Thread(target=self.__master_worker)
        t.start()

        # initiate slave
        slave.initiate()
        while slave.is_session_connecting():
            ret = slave.start_and_check_connect()
            if ret in [0, errno.EINPROGRESS, errno.EALREADY]:
                continue
            elif ret in [
                    errno.EISCONN,
            ]:
                slave.session_state = slave.SESSION_STATE_GCP_SLAVE_INITIATED
                break
            else:
                break
        self.assertTrue(slave.is_initiated())

        # wait for the thread
        t.join()

        # close slave
        slave.close()
        self.assertTrue(slave.is_session_failed())

        # close master
        self.master.close()
        self.assertTrue(self.master.is_session_failed())
Ejemplo n.º 9
0
    def test_rcp_msg_cb_basic(self):
        print '############test rcp_msg_cb basic case#############'
        # seq==None
        self.agent.rcp_msg_cb(None)

        seq = t_RcpMessage()
        self.agent.rcp_msg_cb(seq)

        seq = RCPSequence(gcp_msg_def.DataStructREQ,
                          rcp_tlv_def.RCP_MSG_TYPE_REX,
                          1,
                          rcp_tlv_def.RCP_OPERATION_TYPE_READ,
                          unittest=True)
        desc = GCPSlaveDescriptor(
            '1.1.1.1', port_master='8190', addr_local='1.1.1.2',
            interface_local='eth0',
            addr_family=socket.AF_INET)
        orch = self.agent.process.orchestrator
        session = RCPSlaveSession(desc, self.agent.process.dispatcher,
                                  orch.session_initiate_cb,
                                  orch.session_timeout_cb,
                                  orch.session_connecting_timeout_cb)
        self.agent.rcp_msg_cb(seq, (session, 'transaction_identifier', 'trans_id'))
Ejemplo n.º 10
0
    def test_GCPSlaveSession_error(self):
        desc = GCPSlaveDescriptor(addr_master='localhost',
                                  port_master=60001,
                                  interface_master='localhost',
                                  interface_local="localhost",
                                  addr_family=socket.AF_INET6)
        self.assertEqual(
            str(desc),
            "{}: {}:{} --> {}:{}".format(desc.get_node_type_str(),
                                         desc.addr_local, desc.port_local,
                                         desc.addr_remote, desc.port_remote))
        session = GCPSlaveSession(desc)
        session.session_state = GCPSession.SESSION_STATE_FAILED
        try:
            session.initiate()
        except Exception as e:
            self.assertIsInstance(e, GCPSessionError)
        session.reinit()
        session.initiate()
        self.assertFalse(session.is_initiated())

        desc = GCPSlaveDescriptor(addr_master='localhost',
                                  port_master=60001,
                                  port_local=60002,
                                  interface_local="localhost",
                                  addr_family=socket.AF_INET6)
        session = GCPSlaveSession(desc)
        session.initiate()
        self.assertFalse(session.is_initiated())

        desc = GCPSlaveDescriptor(addr_master='localhost',
                                  port_master=60001,
                                  addr_family=socket.AF_INET6)
        session = GCPSlaveSession(desc)
        session.initiate()
        self.assertNotEqual(session.session_state,
                            GCPSession.SESSION_STATE_INIT)

        session.close()
Ejemplo n.º 11
0
    def test_send_vsp_tlv_unmatched_vid_to_drv(self):
        print "test_send_vsp_tlv_unmatched_vid_to_drv\n"

        timeOut = time.time() + 5
        while self.hal_ipc is not None and self.hal_ipc.disconnected and time.time(
        ) < timeOut:
            pass

        desc = GCPSlaveDescriptor("127.0.0.1",
                                  port_master=9999,
                                  addr_local="127.0.0.1",
                                  interface_local="lo",
                                  addr_family=socket.AF_INET)
        dummy_session = RCPSlaveSession(desc, self.dispatcher, self.fake_cb,
                                        self.fake_cb, self.fake_cb)
        seq = self.vsp_tlv_seq_unmatched_vid.create_vendor_tlvs_sequence(
            gcp_msg_def.NotifyREQ, rcp_tlv_def.RCP_MSG_TYPE_NTF,
            rcp_tlv_def.RCP_OPERATION_TYPE_WRITE)
        ipc_msg = {
            'session': dummy_session,
            'req_packet': "dummy-packet",
            'gcp_msg': "dummy-message",
            'req_data': [
                seq,
            ],
        }
        if None is not self.hal_ipc:
            self.hal_ipc.rcp_cfg_req(ipc_msg)
        time.sleep(1)

        pkt_db = self.hal_ipc.msg_record.pkt_db
        pkt_db_len = len(pkt_db)

        # since the seq contains unmatched vendor id, but there is no check for vid
        # so this VendorSpecificExtension TLV still sent to driver.
        self.assertTrue(pkt_db_len == 0)
Ejemplo n.º 12
0
    def test_rec_send(self):
        # need to start master first
        desc = GCPMasterDescriptor(addr=None, port=60001)
        self.master = GCPMaster(session_descriptor=desc)
        self.master.initiate()
        self.assertTrue(self.master.is_initiated())

        # slave init error case
        desc = "test"
        try:
            slave = GCPSlaveSession(desc)
        except Exception as e:
            self.assertIsInstance(e, GCPSlaveSessionError)

        try:
            slave = GCPSession(desc)
        except Exception as e:
            self.assertIsInstance(e, TypeError)

        # create slave
        desc = GCPSlaveDescriptor(addr_master='localhost', port_master=60001)
        slave = GCPSlaveSession(desc)
        self.assertFalse(slave.is_initiated())

        # start master working thread
        t = threading.Thread(target=self.__master_worker_send_rec)
        t.start()

        # initiate slave
        slave.initiate()
        while slave.is_session_connecting():
            ret = slave.start_and_check_connect()
            if ret in [0, errno.EINPROGRESS, errno.EALREADY]:
                continue
            elif ret in [
                    errno.EISCONN,
            ]:
                slave.session_state = slave.SESSION_STATE_GCP_SLAVE_INITIATED
                break
            else:
                break
        self.assertTrue(slave.is_initiated())

        packet_send = GCPPacket()
        packet_send.transaction_identifier = 1
        packet_send.protocol_identifier = 2
        packet_send.length = 1  # just unit ID
        packet_send.unit_id = 255

        ctx = slave.get_fd_io_ctx(slave.get_socket_fd())
        ctx.add_tx_packet(packet_send)

        rd, wr, ex = select.select([], [slave.get_socket()], [])
        self.assertFalse(not wr, "No any socket for write")

        ret = slave.send_pkt(slave.get_socket_fd())
        self.assertTrue(ret[0] == GCPSession.PKT_SEND_DONE,
                        "Failed to send packet to master")

        rd, wr, ex = select.select([slave.get_socket()], [], [])
        self.assertFalse(not rd, "No any socket for read")

        packet_received = slave.read_pkt(slave.get_socket_fd())
        self.assertFalse(None is packet_received, "Packet receive failed")

        # self.failUnless(packet_received._ut_compare(packet_send),
        #                 "Received broken packet")

        # test add_tx_packet high queue case
        ctx.add_tx_packet(gcp_packet=packet_send, high_priority=True)
        rd, wr, ex = select.select([], [slave.get_socket()], [])
        self.assertFalse(not wr, "No any socket for write")

        ret = slave.send_pkt(slave.get_socket_fd())
        self.assertTrue(ret[0] == GCPSession.PKT_SEND_DONE,
                        "Failed to send packet to master")

        rd, wr, ex = select.select([slave.get_socket()], [], [])
        self.assertFalse(not rd, "No any socket for read")

        packet_received = slave.read_pkt(slave.get_socket_fd())
        self.assertFalse(None is packet_received, "Packet receive failed")

        # test add_tx_packet  low priority queue full case
        self.assertTrue(ctx.is_tx_empty())
        for i in range(0, GCPSession.TX_LOW_PRI_QUEUE_SIZE):
            ctx.add_tx_packet(packet_send)
            if i < GCPSession.TX_LOW_PRI_QUEUE_HIGH_WATERMARK - 1:
                self.assertFalse(ctx.is_tx_low_pri_queue_at_high_watermark())
            else:
                self.assertTrue(ctx.is_tx_low_pri_queue_at_high_watermark())

        self.assertTrue(ctx.packet_tx_low_pri_queue.full())
        try:
            ctx.add_tx_packet(packet_send)
        except Exception as e:
            self.assertIsInstance(e, GCPSessionFull)

        # test add_tx_packet  high priority queue full case
        for i in range(0, GCPSession.TX_HIGH_PRI_QUEUE_SIZE):
            ctx.add_tx_packet(gcp_packet=packet_send, high_priority=True)
        self.assertTrue(ctx.packet_tx_high_pri_queue.full())
        try:
            ctx.add_tx_packet(gcp_packet=packet_send, high_priority=True)
        except Exception as e:
            self.assertIsInstance(e, GCPSessionFull)

        # test add_tx_packet queue None
        ctx.packet_tx_high_pri_queue = None
        ctx.packet_tx_low_pri_queue = Queue.Queue(
            GCPSession.TX_LOW_PRI_QUEUE_SIZE)
        # pkt can not be added
        ret = ctx.add_tx_packet(packet_send)
        self.assertFalse(ret)

        # low queue is none
        ctx.packet_tx_high_pri_queue = Queue.Queue(
            GCPSession.TX_HIGH_PRI_QUEUE_SIZE)
        ctx.packet_tx_low_pri_queue = None
        # pkt can not be added
        ret = ctx.add_tx_packet(packet_send)
        self.assertFalse(ret)

        # high queue is none
        ctx.packet_tx_high_pri_queue = Queue.Queue(
            GCPSession.TX_HIGH_PRI_QUEUE_SIZE)
        ctx.packet_tx_low_pri_queue = Queue.Queue(
            GCPSession.TX_LOW_PRI_QUEUE_SIZE)

        ret = ctx.get_tx_packet()
        self.assertIsNone(ret)

        # wait for the thread
        self.master_rec_send_run = False
        t.join()

        # close slave
        slave.close()
        self.assertTrue(slave.is_session_failed())

        # close master
        self.master.close()
        self.assertTrue(self.master.is_session_failed())
Ejemplo n.º 13
0
 def setUpClass(cls):
     setup_logging('GCP', filename="provision_rcp.log")
     cls.dispatcher = Dispatcher()
     cls.desc = GCPSlaveDescriptor(addr_master='localhost')
     cls.session = RCPSlaveSession(cls.desc, cls.dispatcher,
                                   fake_cb, fake_cb, fake_cb)
Ejemplo n.º 14
0
    def test_rcp_msg_cb_event(self):
        print '############test rcp_msg_cb event case#############'
        RCPDB.DB_CFG_FILE = CONF_FILE
        seq = RCPSequence(gcp_msg_def.DataStructREQ,
                          rcp_tlv_def.RCP_MSG_TYPE_REX,
                          1,
                          rcp_tlv_def.RCP_OPERATION_TYPE_READ,
                          unittest=True)
        desc = GCPSlaveDescriptor(
            '1.1.1.1', port_master='8190', addr_local='1.1.1.2',
            interface_local='eth0',
            addr_family=socket.AF_INET)
        orch = self.agent.process.orchestrator
        session = RCPSlaveSession(desc, self.agent.process.dispatcher,
                                  orch.session_initiate_cb,
                                  orch.session_timeout_cb,
                                  orch.session_connecting_timeout_cb)
        # reboot
        rcp_msg = t_RcpMessage()
        rcp_msg.RcpMessageType = rcp_msg.RPD_REBOOT

        ccap_core_para = {'addr_remote': '1.1.1.1', 'interface_local': 'eth1', 'info': "test"}
        rcp_msg.parameter = json.dumps(ccap_core_para)
        self.agent.rcp_msg_cb(rcp_msg)

        # redirect
        rcp_msg = t_RcpMessage()
        rcp_msg.RcpMessageType = rcp_msg.REDIRECT_NOTIFICATION
        ccap_core_para = {'addr_remote': '1.1.1.1', 'interface_local': 'eth0', 'info': "test"}
        rcp_msg.parameter = json.dumps(ccap_core_para)
        rcp_msg.RedirectCCAPAddresses.append('3.3.3.3')
        self.agent.rcp[('eth0', '1.1.1.1')]['status'] = self.agent.UP
        self.agent.rcp_msg_cb(rcp_msg)

        # configuration
        rcp_msg = t_RcpMessage()
        rcp_msg.RcpMessageType = rcp_msg.RPD_CONFIGURATION
        cfg = rcp_msg.RpdDataMessage.RpdData
        rcp_msg.parameter = 'eth0'
        capability = cfg.CcapCoreIdentification.add()
        capability.Index = 1
        capability.CoreId = 'CoreId'
        capability.CoreIpAddress = '1.1.1.1'
        capability.IsPrincipal = True
        capability.CoreMode = 1
        capability.CoreName = "CiscoRPD"
        capability.VendorId = 1
        capability.InitialConfigurationComplete = True
        capability.MoveToOperational = True
        capability.CoreFunction = 1
        capability.ResourceSetIndex = 2
        self.agent.rcp[('eth0', '1.1.1.1')]['status'] = self.agent.DOWN
        self.agent.rcp_msg_cb(rcp_msg)

        # RedundantCoreIpAddress
        rcp_msg = t_RcpMessage()
        rcp_msg.RcpMessageType = rcp_msg.RPD_CONFIGURATION
        cfg = rcp_msg.RpdDataMessage.RpdData
        rcp_msg.parameter = 'eth0'
        red = cfg.RedundantCoreIpAddress.add()
        red.ActiveCoreIpAddress = '1.1.1.1'
        red.StandbyCoreIpAddress = '1.1.1.3'
        self.agent.rcp_msg_cb(rcp_msg)  # no must field

        desc1 = GCPSlaveDescriptor(
            '1.1.1.1', port_master='8190', addr_local='1.1.1.2',
            interface_local='eth0',
            addr_family=socket.AF_INET)
        orch = self.agent.process.orchestrator
        session_1 = RCPSlaveSession(desc1, self.agent.process.dispatcher,
                                    orch.session_initiate_cb,
                                    orch.session_timeout_cb,
                                    orch.session_connecting_timeout_cb)
        self.agent.process.orchestrator.sessions_active[desc1.get_uniq_id()] = session_1
        caps1 = CcapCoreIdentification(index=1,
                                       core_id="CoreId-1",
                                       core_ip_addr='1.1.1.1',
                                       is_principal=True,
                                       core_name="SIM_GCPP",
                                       vendor_id=0,
                                       core_mode=True,
                                       initial_configuration_complete=True,
                                       move_to_operational=True,
                                       core_function=1,
                                       resource_set_index=2)
        session_1.ccap_identification = caps1

        desc2 = GCPSlaveDescriptor(
            '1.1.1.3', port_master='8190', addr_local='1.1.1.2',
            interface_local='eth0',
            addr_family=socket.AF_INET)
        orch = self.agent.process.orchestrator
        session_2 = RCPSlaveSession(desc2, self.agent.process.dispatcher,
                                    orch.session_initiate_cb,
                                    orch.session_timeout_cb,
                                    orch.session_connecting_timeout_cb)
        # self.agent.process.orchestrator.add_sessions([desc2])
        self.agent.process.orchestrator.sessions_active[desc2.get_uniq_id()] = session_2
        caps2 = CcapCoreIdentification(index=1,
                                       core_id="CoreId-2",
                                       core_ip_addr='1.1.1.1',
                                       is_principal=True,
                                       core_name="SIM_GCPP",
                                       vendor_id=0,
                                       core_mode=True,
                                       initial_configuration_complete=True,
                                       move_to_operational=True,
                                       core_function=1,
                                       resource_set_index=2)
        session_2.ccap_identification = caps2

        caps1.is_active = False
        caps2.is_active = True
        red.Operation = ManagerProcess.OPERATION_ADD
        self.agent.rcp_msg_cb(rcp_msg)

        caps1.is_active = True
        caps2.is_active = False
        red.Operation = ManagerProcess.OPERATION_CHANGE
        self.agent.rcp_msg_cb(rcp_msg)

        # ConfiguredCoreTable
        # miss operation field
        rcp_msg = t_RcpMessage()
        rcp_msg.RcpMessageType = rcp_msg.RPD_CONFIGURATION
        cfg = rcp_msg.RpdDataMessage.RpdData
        cfg_core = cfg.ConfiguredCoreTable.add()
        cfg_core.ConfiguredCoreIp = '1.1.1.1'
        self.agent.rcp_msg_cb(rcp_msg)

        cfg_core.Operation = 0
        self.agent.rcp_msg_cb(rcp_msg)

        # ActivePrincipalCore
        rcp_msg = t_RcpMessage()
        rcp_msg.RcpMessageType = rcp_msg.RPD_CONFIGURATION
        cfg = rcp_msg.RpdDataMessage.RpdData
        cfg.ActivePrincipalCore = '1.1.1.1'
        seq.ipc_msg = rcp_msg
        self.agent.rcp_msg_cb(seq, (session, 'transaction_identifier', 'trans_id'))

        # RPD_CONFIGURATION else
        rcp_msg = t_RcpMessage()
        rcp_msg.RcpMessageType = rcp_msg.RPD_CONFIGURATION
        cfg = rcp_msg.RpdDataMessage.RpdData
        cfg_core = cfg.Ssd
        cfg_core.SsdServerAddress = '1.1.1.1'
        self.agent.rcp_msg_cb(rcp_msg)

        # configuration done
        rcp_msg = t_RcpMessage()
        rcp_msg.RcpMessageType = rcp_msg.RPD_CONFIGURATION_DONE
        rcp_msg.parameter = ';'.join(['eth0', '1.1.1.1'])
        self.agent.principal_core_interface = 'eth0'
        self.agent.principal_core = '1.1.1.1'
        self.agent.rcp_msg_cb(rcp_msg, (session, 'transaction_identifier', 'trans_id'))

        # CONNECT_CLOSE_NOTIFICATION
        rcp_msg = t_RcpMessage()
        rcp_msg.RcpMessageType = rcp_msg.CONNECT_CLOSE_NOTIFICATION
        ccap_core_para = {'addr_remote': '1.1.1.1', 'interface_local': 'eth0', "reconnect": True}
        rcp_msg.parameter = json.dumps(ccap_core_para)
        self.agent.ccap_cores.pop('CORE-1234567890')
        self.agent.rcp_msg_cb(rcp_msg)

        ccap_core_para = {'addr_remote': '1.1.1.1', 'interface_local': 'eth0', "reconnect": False}
        rcp_msg.parameter = json.dumps(ccap_core_para)
        self.agent.rcp_msg_cb(rcp_msg)