Beispiel #1
0
    class Vpn(Model):
        def __init__(self, id):
            self.id = id

        veth = Property(typ=str)
        veth_state = Property()
        links = Hash()
        chal = Property(typ=Model)
Beispiel #2
0
    class User(Model):
        def __init__(self, id):
            self.id = id

        vlan = Property(typ=int)
        cn = Property(typ=str)
        status = Property()
        connections = Set(typ=Model)
Beispiel #3
0
class X(Model):
    def __init__(self, id):
        self.id = id

    one = Property(autocommit=False, typ=bytes)
    two = Property('2', typ=str)
    three = Property(alwaysfetch=True, typ=int)
    four = Property(autocommit=False, typ=float)
Beispiel #4
0
    class Connection(Model):
        def __init__(self, addr):
            self.id = repr(addr)
            self.addr = addr

        addr = Property(typ=Address)
        alive = Property(typ=bool)
        user = Property(typ=Model)
        vpn = Property(typ=Model)
Beispiel #5
0
    class Vpn(Model):
        LINK_UP = 'up'
        LINK_BRIDGED = 'bridged'
        LINK_DOWN = 'down'
        VETH_UP = 'up'
        VETH_DOWN = 'down'

        def __init__(self, id):
            self.id = id

        lock = Lock(timeout=30)
        veth = Property(typ=str)
        veth_state = Property(typ=str)
        chal = Property(typ=Model)
        links = Hash(typ=str)
Beispiel #6
0
    class Cluster(Model):
        UP = 'up'
        EXPIRING = 'expiring'
        STOPPED = 'stopped'
        DOWN = 'down'

        def __init__(self, user, chal):
            self.id = '{}@{}'.format(user.id, chal.id)

        @property
        def project(self):
            return self.id.replace('@', '_', 1)

        lock = Lock(timeout=300)
        status = Property(typ=str)
        connections = Set(typ=Model)
        vpn = Property(typ=Model)
Beispiel #7
0
        class X(Database):
            redis = canary

            prop = Property()

            collect = Set()

            class Mod(Model):
                pass
Beispiel #8
0
 class X:
     redis = self.redis
     prop = Property("p", autocommit=True)
     key = "xkey"
Beispiel #9
0
class A:
    def __init__(self, redis=None, autocommit=False):
        self.redis = redis

    alpha = Property("abc", autocommit=False)
Beispiel #10
0
 class X:
     redis = self.redis
     prop = Property("p")
     key = "xkey"
Beispiel #11
0
 class X:
     prop = Property("p")
     key = "xkey"
Beispiel #12
0
 class X:
     prop = Property("prop")
     key = None
Beispiel #13
0
 def test_mangle(self):
     nameA, nameB = "fred", "wilma"
     self.assertNotEqual(Property.mangle(nameA), nameA)
     self.assertNotEqual(Property.mangle(nameA), Property.mangle(nameB))
Beispiel #14
0
 class X:
     redis = self.redis
     prop = Property("p", alwaysfetch=False)
     key = "xkey"
Beispiel #15
0
    class User(Model):
        def __init__(self, id):
            self.id = id

        vlan = Property(typ=int)
        cn = Property(typ=str)
Beispiel #16
0
    class Cluster(Model):
        def __init__(self, user, chal):
            self.id = '{}!{}'.format(user.id, chal.id)

        status = Property(typ=str)