schema.sql.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #define ZT_NETCONF_SCHEMA_SQL \
  2. "CREATE TABLE Config (\n"\
  3. " k varchar(16) PRIMARY KEY NOT NULL,\n"\
  4. " v varchar(1024) NOT NULL\n"\
  5. ");\n"\
  6. "\n"\
  7. "CREATE TABLE IpAssignment (\n"\
  8. " networkId char(16) NOT NULL,\n"\
  9. " nodeId char(10) NOT NULL,\n"\
  10. " ip blob(16) NOT NULL,\n"\
  11. " ipNetmaskBits integer NOT NULL DEFAULT(0),\n"\
  12. " ipVersion integer NOT NULL DEFAULT(4)\n"\
  13. ");\n"\
  14. "\n"\
  15. "CREATE INDEX IpAssignment_networkId_ip ON IpAssignment (networkId, ip);\n"\
  16. "\n"\
  17. "CREATE INDEX IpAssignment_networkId_nodeId ON IpAssignment (networkId, nodeId);\n"\
  18. "\n"\
  19. "CREATE INDEX IpAssignment_networkId ON IpAssignment (networkId);\n"\
  20. "\n"\
  21. "CREATE TABLE IpAssignmentPool (\n"\
  22. " networkId char(16) NOT NULL,\n"\
  23. " ipNetwork blob(16) NOT NULL,\n"\
  24. " ipNetmaskBits integer NOT NULL,\n"\
  25. " ipVersion integer NOT NULL DEFAULT(4)\n"\
  26. ");\n"\
  27. "\n"\
  28. "CREATE INDEX IpAssignmentPool_networkId ON IpAssignmentPool (networkId);\n"\
  29. "\n"\
  30. "CREATE TABLE Member (\n"\
  31. " networkId char(16) NOT NULL,\n"\
  32. " nodeId char(10) NOT NULL,\n"\
  33. " authorized integer NOT NULL DEFAULT(0),\n"\
  34. " activeBridge integer NOT NULL DEFAULT(0)\n"\
  35. ");\n"\
  36. "\n"\
  37. "CREATE INDEX Member_networkId ON Member (networkId);\n"\
  38. "\n"\
  39. "CREATE INDEX Member_networkId_activeBridge ON Member(networkId, activeBridge);\n"\
  40. "\n"\
  41. "CREATE UNIQUE INDEX Member_networkId_nodeId ON Member (networkId, nodeId);\n"\
  42. "\n"\
  43. "CREATE TABLE MulticastRate (\n"\
  44. " networkId char(16) NOT NULL,\n"\
  45. " mgMac char(12) NOT NULL,\n"\
  46. " mgAdi integer NOT NULL DEFAULT(0),\n"\
  47. " preload integer NOT NULL,\n"\
  48. " maxBalance integer NOT NULL,\n"\
  49. " accrual integer NOT NULL\n"\
  50. ");\n"\
  51. "\n"\
  52. "CREATE INDEX MulticastRate_networkId ON MulticastRate (networkId);\n"\
  53. "\n"\
  54. "CREATE TABLE Network (\n"\
  55. " id char(16) PRIMARY KEY NOT NULL,\n"\
  56. " name varchar(128) NOT NULL,\n"\
  57. " private integer NOT NULL DEFAULT(1),\n"\
  58. " enableBroadcast integer NOT NULL DEFAULT(1),\n"\
  59. " allowPassiveBridging integer NOT NULL DEFAULT(0),\n"\
  60. " v4AssignMode varchar(8) NOT NULL DEFAULT('none'),\n"\
  61. " v6AssignMode varchar(8) NOT NULL DEFAULT('none'),\n"\
  62. " multicastLimit integer NOT NULL DEFAULT(32),\n"\
  63. " creationTime integer NOT NULL DEFAULT(0),\n"\
  64. " revision integer NOT NULL DEFAULT(1)\n"\
  65. ");\n"\
  66. "\n"\
  67. "CREATE TABLE Relay (\n"\
  68. " networkId char(16) NOT NULL,\n"\
  69. " nodeId char(10) NOT NULL,\n"\
  70. " phyAddress varchar(64) NOT NULL\n"\
  71. ");\n"\
  72. "\n"\
  73. "CREATE INDEX Relay_networkId ON Relay (networkId);\n"\
  74. "\n"\
  75. "CREATE UNIQUE INDEX Relay_networkId_nodeId ON Relay (networkId, nodeId);\n"\
  76. "\n"\
  77. "CREATE TABLE Node (\n"\
  78. " id char(10) PRIMARY KEY NOT NULL,\n"\
  79. " identity varchar(4096) NOT NULL,\n"\
  80. " lastAt varchar(64),\n"\
  81. " lastSeen integer NOT NULL DEFAULT(0),\n"\
  82. " firstSeen integer NOT NULL DEFAULT(0)\n"\
  83. ");\n"\
  84. "\n"\
  85. "CREATE TABLE Rule (\n"\
  86. " networkId char(16) NOT NULL,\n"\
  87. " ruleId integer NOT NULL,\n"\
  88. " nodeId char(10),\n"\
  89. " vlanId integer,\n"\
  90. " vlanPcp integer,\n"\
  91. " etherType integer,\n"\
  92. " macSource char(12),\n"\
  93. " macDest char(12),\n"\
  94. " ipSource varchar(64),\n"\
  95. " ipDest varchar(64),\n"\
  96. " ipTos integer,\n"\
  97. " ipProtocol integer,\n"\
  98. " ipSourcePort integer,\n"\
  99. " ipDestPort integer,\n"\
  100. " flags integer,\n"\
  101. " invFlags integer,\n"\
  102. " \"action\" varchar(4096) NOT NULL DEFAULT('accept')\n"\
  103. ");\n"\
  104. "\n"\
  105. "CREATE INDEX Rule_networkId ON Rule (networkId);\n"\
  106. ""