Esempio n. 1
0
    def queryStaleSessions(self):
        staleSessions = list()
        keys = self.sessions.keys()
        for sessionId in keys:
            session = self.sessions[sessionId]
            if session.stale:
                self.logger.debug(
                    "query for stale session [%d, %d]" %
                    (session.localSessionId, session.remoteSessionId))
                staleSessions.append(session)

        if staleSessions:
            fsqAvp = L2tpv3RFC3931AVPs.ControlMessageAVP(
                L2tpv3RFC3931AVPs.ControlMessageAVP.FSQ)
            fssAvps = tuple()
            for ses in staleSessions:
                fss = L2tpv3RFC3931AVPs.FailoverSessionState(
                    ses.localSessionId, ses.remoteSessionId)
                fssAvps = fssAvps + (fss, )
            fsq = L2tpv3ControlPacket.L2tpv3ControlPacket(
                self.remoteConnID, 0, 0, (fsqAvp, ) + fssAvps)
            self.transport.SendPacket(fsq)
Esempio n. 2
0
    def queryInactSessions(self):
        inActiveSessions = list()
        keys = self.sessions.keys()
        for sessionId in keys:
            session = self.sessions[sessionId]
            if session.local_circuit_status != L2tpv3Session.L2tpv3Session.CIRCUIT_STATUS_UP:
                self.logger.debug(
                    "query for inactive session [%d, %d]" %
                    (session.localSessionId, session.remoteSessionId))
                inActiveSessions.append(session)

        if inActiveSessions:
            fsqAvp = L2tpv3RFC3931AVPs.ControlMessageAVP(
                L2tpv3RFC3931AVPs.ControlMessageAVP.FSQ)
            fssAvps = tuple()
            for ses in inActiveSessions:
                fss = L2tpv3RFC3931AVPs.FailoverSessionState(
                    ses.localSessionId, ses.remoteSessionId)
                fssAvps = fssAvps + (fss, )
            fsq = L2tpv3ControlPacket.L2tpv3ControlPacket(
                self.remoteConnID, 0, 0, (fsqAvp, ) + fssAvps)
            self.transport.SendPacket(fsq)