def setUp(self):
        yield SMPPClientTestCases.setUp(self)

        # Init SMPPServerPB
        SMPPServerPBConfigInstance = SMPPServerPBConfig()
        SMPPServerPBInstance = SMPPServerPB(SMPPServerPBConfigInstance)
        SMPPServerPBInstance.addSmpps(self.smpps_factory)

        p = portal.Portal(JasminPBRealm(SMPPServerPBInstance))
        c = InMemoryUsernamePasswordDatabaseDontUse()
        c.addUser('smppsadmin', md5('smppspwd'.encode('ascii')).digest())
        p.registerChecker(c)
        jPBPortalRoot = JasminPBPortalRoot(p)
        self.SMPPServerPBInstanceServer = reactor.listenTCP(SMPPServerPBConfigInstance.port,
                                                            pb.PBServerFactory(jPBPortalRoot))

        # Init SMPPServerPBClient and connect it to SMPPServerPB
        SMPPServerPBClientConfigInstance = SMPPServerPBClientConfig()
        self.SMPPServerPBProxyInstance = SMPPServerPBProxy()
        yield self.SMPPServerPBProxyInstance.connect(
            SMPPServerPBClientConfigInstance.host,
            SMPPServerPBClientConfigInstance.port,
            SMPPServerPBClientConfigInstance.username,
            SMPPServerPBClientConfigInstance.password,
            retry=False)

        # Lower the timeout config to pass the timeout tests quickly
        self.DLRThrower.config.timeout = 2
        self.DLRThrower.config.retry_delay = 1
        self.DLRThrower.config.max_retries = 2

        # Most important thing:
        # Swap default direct smpps access to perspectivebroker smpps access:
        self.DLRThrower.addSmpps(self.SMPPServerPBProxyInstance)
    def setUp(self):
        yield SMPPClientTestCases.setUp(self)

        # Init SMPPServerPB
        SMPPServerPBConfigInstance = SMPPServerPBConfig()
        SMPPServerPBInstance = SMPPServerPB(SMPPServerPBConfigInstance)
        SMPPServerPBInstance.addSmpps(self.smpps_factory)

        p = portal.Portal(JasminPBRealm(SMPPServerPBInstance))
        c = InMemoryUsernamePasswordDatabaseDontUse()
        c.addUser('smppsadmin', md5('smppspwd').digest())
        p.registerChecker(c)
        jPBPortalRoot = JasminPBPortalRoot(p)
        self.SMPPServerPBInstanceServer = reactor.listenTCP(SMPPServerPBConfigInstance.port,
                                                            pb.PBServerFactory(jPBPortalRoot))

        # Init SMPPServerPBClient and connect it to SMPPServerPB
        SMPPServerPBClientConfigInstance = SMPPServerPBClientConfig()
        self.SMPPServerPBProxyInstance = SMPPServerPBProxy()
        yield self.SMPPServerPBProxyInstance.connect(
            SMPPServerPBClientConfigInstance.host,
            SMPPServerPBClientConfigInstance.port,
            SMPPServerPBClientConfigInstance.username,
            SMPPServerPBClientConfigInstance.password,
            retry=False)

        # Lower the timeout config to pass the timeout tests quickly
        self.DLRThrower.config.timeout = 2
        self.DLRThrower.config.retry_delay = 1
        self.DLRThrower.config.max_retries = 2

        # Most important thing:
        # Swap default direct smpps access to perspectivebroker smpps access:
        self.DLRThrower.addSmpps(self.SMPPServerPBProxyInstance)
Esempio n. 3
0
    def setUp(self, authentication=False):
        SMPPServerTestCases.setUp(self)

        # Initiating config objects without any filename
        self.SMPPServerPBConfigInstance = SMPPServerPBConfig()
        self.SMPPServerPBConfigInstance.authentication = authentication

        # Launch the SMPPServerPB
        pbRoot = SMPPServerPB(self.SMPPServerPBConfigInstance)
        pbRoot.addSmpps(self.smpps_factory)

        p = portal.Portal(JasminPBRealm(pbRoot))
        if not authentication:
            p.registerChecker(AllowAnonymousAccess())
        else:
            c = InMemoryUsernamePasswordDatabaseDontUse()
            c.addUser('test_user', md5('test_password').digest())
            p.registerChecker(c)
        jPBPortalRoot = JasminPBPortalRoot(p)
        self.PBServer = reactor.listenTCP(0, pb.PBServerFactory(jPBPortalRoot))
        self.pbPort = self.PBServer.getHost().port
Esempio n. 4
0
    def setUp(self, authentication=False):
        SMPPServerTestCases.setUp(self)

        # Initiating config objects without any filename
        self.SMPPServerPBConfigInstance = SMPPServerPBConfig()
        self.SMPPServerPBConfigInstance.authentication = authentication

        # Launch the SMPPServerPB
        pbRoot = SMPPServerPB(self.SMPPServerPBConfigInstance)
        pbRoot.addSmpps(self.smpps_factory)

        p = portal.Portal(JasminPBRealm(pbRoot))
        if not authentication:
            p.registerChecker(AllowAnonymousAccess())
        else:
            c = InMemoryUsernamePasswordDatabaseDontUse()
            c.addUser('test_user', md5('test_password').digest())
            p.registerChecker(c)
        jPBPortalRoot = JasminPBPortalRoot(p)
        self.PBServer = reactor.listenTCP(0, pb.PBServerFactory(jPBPortalRoot))
        self.pbPort = self.PBServer.getHost().port
Esempio n. 5
0
    def startSMPPServerPBService(self):
        """Start SMPP Server PB server"""

        SMPPServerPBConfigInstance = SMPPServerPBConfig(self.options['config'])
        self.components['smpps-pb-factory'] = SMPPServerPB(
            SMPPServerPBConfigInstance)

        # Set authentication portal
        p = portal.Portal(JasminPBRealm(self.components['smpps-pb-factory']))
        if SMPPServerPBConfigInstance.authentication:
            c = InMemoryUsernamePasswordDatabaseDontUse()
            c.addUser(SMPPServerPBConfigInstance.admin_username,
                      SMPPServerPBConfigInstance.admin_password)
            p.registerChecker(c)
        else:
            p.registerChecker(AllowAnonymousAccess())
        jPBPortalRoot = JasminPBPortalRoot(p)

        # Add service
        self.components['smpps-pb-server'] = reactor.listenTCP(
            SMPPServerPBConfigInstance.port,
            pb.PBServerFactory(jPBPortalRoot),
            interface=SMPPServerPBConfigInstance.bind)