@@ -0,0 +1,3252 @@
+import json%0Aimport datetime%0Aimport sqlalchemy as sa%0Afrom neutron.db import models_v2%0Afrom neutron.db import model_base%0Afrom sqlalchemy.dialects import postgresql%0Afrom sqlalchemy.dialects.mysql.base import INTEGER, VARCHAR%0Afrom sqlalchemy.orm import relationship, backref, sessionmaker%0Afrom sqlalchemy.types import Enum, TIMESTAMP, TypeDecorator%0Afrom sqlalchemy import Table, Column, ForeignKey, func, Integer, create_engine%0A%0Aclass JSONEncodedDict(TypeDecorator):%0A    %22%22%22Represents an immutable structure as a json-encoded string.%0A    Usage::%0A        JSONEncodedDict(255)%0A    %22%22%22%0A    impl = VARCHAR%0A    def process_bind_param(self, value, dialect):%0A        if value is not None:%0A            value = json.dumps(value)%0A        return value%0A%0A    def process_result_value(self, value, dialect):%0A        if value is not None:%0A            value = json.loads(value)%0A        return value%0A%0Aclass ReachabilityTest(model_base.BASEV2):%0A    '''%0A    A table to store user configured reachability tests.%0A    '''%0A    __tablename__ = 'reachabilitytest'%0A    id = Column(Integer, primary_key=True)%0A    tenant_id = sa.Column(sa.String(64), primary_key=False, nullable=False)%0A    test_id = sa.Column(sa.String(64), primary_key=False, nullable=False)%0A    src_tenant_id = sa.Column(sa.String(64), primary_key=False, nullable=False)%0A    src_segment_id = sa.Column(sa.String(64), primary_key=False, nullable=False)%0A    src_ip = sa.Column(INTEGER(unsigned=True), nullable=False, primary_key=False)%0A    dst_tenant_id = sa.Column(sa.String(64), nullable=False, primary_key=False)%0A    dst_segment_id = sa.Column(sa.String(64), nullable=False, primary_key=False)%0A    dst_ip = sa.Column(INTEGER(unsigned=True), nullable=False)%0A    expected_result = sa.Column(Enum(%22reached destination%22, %22dropped by route%22, %22dropped by policy%22, %5C%0A                                     %22dropped due to private segment%22, %22packet in%22, %22forwared%22, %22dropped%22, %22multiple sources%22, %5C%0A                                     %22unsupported%22, %22invalid input%22, name=%22expected_result%22), nullable=False)%0A%0Aclass ReachabilityTestResult(model_base.BASEV2):%0A    '''%0A    A table to store the results of user configured reachability tests.%0A    '''%0A    __tablename__ = 'reachabilitytestresult'%0A    id = Column(Integer, primary_key=True)%0A    test_primary_key = sa.Column(Integer, ForeignKey('reachabilitytest.id'), nullable=False)%0A    tenant_id = sa.Column(sa.String(64), primary_key=False, nullable=False)%0A    test_id = sa.Column(sa.String(64), primary_key=False, nullable=False)%0A    test_time = sa.Column(TIMESTAMP(timezone=True), primary_key=False, nullable=False, default=func.now())%0A    test_result = sa.Column(Enum(%22PASS%22, %22FAIL%22, %22PENDING%22), nullable=False)%0A    detail = sa.Column(JSONEncodedDict(255), nullable=True)%0A%0A    reachabilitytest = relationship(%22ReachabilityTest%22, backref=backref('reachabilitytestresult',%5C%0A                                                                        order_by=id, uselist=True,%5C%0A                                                                        cascade='delete,all'))%0A%0Adb = create_engine(%22mysql+mysqldb://root:password@127.0.0.1/neutron?charset=utf8%22)%0ADB_session = sessionmaker(bind=db)%0Adb_session = DB_session()%0ABase = model_base.BASEV2()%0ABase.metadata.create_all(bind=db)%0A%0A

add testpath schema