Exemplo n.º 1
0
    def startSMPPServerService(self):
        "Start SMPP Server"

        SMPPServerConfigInstance = SMPPServerConfig(self.options['config'])

        # Set authentication portal
        p = portal.Portal(
            SmppsRealm(SMPPServerConfigInstance.id,
                       self.components['router-pb-factory']))
        p.registerChecker(
            RouterAuthChecker(self.components['router-pb-factory']))

        # SMPPServerFactory init
        self.components['smpp-server-factory'] = SMPPServerFactory(
            SMPPServerConfigInstance,
            auth_portal=p,
            RouterPB=self.components['router-pb-factory'],
            SMPPClientManagerPB=self.components['smppcm-pb-factory'])

        # Start server
        self.components['smpp-server'] = reactor.listenTCP(
            SMPPServerConfigInstance.port,
            self.components['smpp-server-factory'],
            interface=SMPPServerConfigInstance.bind)

        # Add interceptor if enabled:
        if 'interceptor-pb-client' in self.components:
            self.components['smpp-server-factory'].addInterceptorPBClient(
                self.components['interceptor-pb-client'])
Exemplo n.º 2
0
    def setUp(self):
        # Launch AMQP Broker
        AMQPServiceConfigInstance = AmqpConfig()
        AMQPServiceConfigInstance.reconnectOnConnectionLoss = False
        self.amqpBroker = AmqpFactory(AMQPServiceConfigInstance)
        self.amqpBroker.preConnect()
        self.amqpClient = reactor.connectTCP(AMQPServiceConfigInstance.host, AMQPServiceConfigInstance.port,
                                             self.amqpBroker)

        # Wait for AMQP Broker connection to get ready
        yield self.amqpBroker.getChannelReadyDeferred()

        # Instanciate a RouterPB (a requirement for JCliFactory)
        self.RouterPBConfigInstance = RouterPBConfig()
        self.RouterPBConfigInstance.authentication = False
        self.RouterPB_f = RouterPB(self.RouterPBConfigInstance)

        # Instanciate a SMPPClientManagerPB (a requirement for JCliFactory)
        SMPPClientPBConfigInstance = SMPPClientPBConfig()
        SMPPClientPBConfigInstance.authentication = False
        self.clientManager_f = SMPPClientManagerPB(SMPPClientPBConfigInstance)
        yield self.clientManager_f.addAmqpBroker(self.amqpBroker)

        # Instanciate a SMPPServerFactory (a requirement for JCliFactory)
        SMPPServerConfigInstance = SMPPServerConfig()

        # Portal init
        _portal = portal.Portal(SmppsRealm(SMPPServerConfigInstance.id, self.RouterPB_f))
        _portal.registerChecker(RouterAuthChecker(self.RouterPB_f))

        self.SMPPSFactory = SMPPServerFactory(
            config=SMPPServerConfigInstance,
            auth_portal=_portal,
            RouterPB=self.RouterPB_f,
            SMPPClientManagerPB=self.clientManager_f)
Exemplo n.º 3
0
    def setUp(self, interceptorpb_client=None):
        yield HappySMSCTestCase.setUp(self)

        self.encoder = pdu_encoding.PDUEncoder()

        # SMPPServerConfig init
        self.smpps_config = SMPPServerConfig()

        # Portal init
        _portal = portal.Portal(SmppsRealm(self.smpps_config.id,
                                           self.pbRoot_f))
        _portal.registerChecker(RouterAuthChecker(self.pbRoot_f))

        # Install mocks
        self.clientManager_f.perspective_submit_sm = Mock(
            wraps=self.clientManager_f.perspective_submit_sm)

        # SMPPServerFactory init
        self.smpps_factory = LastProtoSMPPServerFactory(
            self.smpps_config,
            auth_portal=_portal,
            RouterPB=self.pbRoot_f,
            SMPPClientManagerPB=self.clientManager_f,
            interceptorpb_client=interceptorpb_client)
        self.smpps_port = reactor.listenTCP(self.smpps_config.port,
                                            self.smpps_factory)

        # Init protocol for testing
        self.smpps_proto = self.smpps_factory.buildProtocol(('127.0.0.1', 0))
        self.smpps_tr = proto_helpers.StringTransport()
        self.smpps_proto.makeConnection(self.smpps_tr)

        # Add SMPPs factory to DLRThrower
        self.DLRThrower.addSmpps(self.smpps_factory)

        # Install mocks
        self.smpps_proto.sendPDU = Mock(wraps=self.smpps_proto.sendPDU)

        # PDUs used for tests
        self.SubmitSmPDU = SubmitSM(
            source_addr='1234',
            destination_addr='4567',
            short_message='hello !',
            seqNum=1,
        )
        self.DeliverSmPDU = DeliverSM(
            source_addr='4567',
            destination_addr='1234',
            short_message='any content',
            seqNum=1,
        )
        self.DataSmPDU = DataSM(
            source_addr='4567',
            destination_addr='1234',
            message_payload='any content',
            seqNum=1,
        )
Exemplo n.º 4
0
    def setUp(self):
        RouterPBTestCases.setUp(self)

        # SMPPServerConfig init
        self.smpps_config = SMPPServerConfig()

        # Portal init
        _portal = portal.Portal(SmppsRealm(self.smpps_config.id, self.routerpb_factory))
        _portal.registerChecker(RouterAuthChecker(self.routerpb_factory))

        # SMPPServerFactory init
        self.smpps_factory = LastProtoSMPPServerFactory(config=self.smpps_config,
                                                        auth_portal=_portal,
                                                        RouterPB=self.routerpb_factory,
                                                        SMPPClientManagerPB=None)
        self.smpps_port = reactor.listenTCP(self.smpps_config.port, self.smpps_factory)