2
0

netconf-schema.sql.c 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. " active integer NOT NULL DEFAULT(1)\n"\
  27. ");\n"\
  28. "\n"\
  29. "CREATE INDEX IpAssignmentPool_networkId ON IpAssignmentPool (networkId);\n"\
  30. "\n"\
  31. "CREATE TABLE Member (\n"\
  32. " networkId char(16) NOT NULL,\n"\
  33. " nodeId char(10) NOT NULL,\n"\
  34. " cachedNetconf blob(4096),\n"\
  35. " cachedNetconfRevision integer NOT NULL DEFAULT(0),\n"\
  36. " clientReportedRevision integer NOT NULL DEFAULT(0),\n"\
  37. " authorized integer NOT NULL DEFAULT(0),\n"\
  38. " activeBridge integer NOT NULL DEFAULT(0)\n"\
  39. ");\n"\
  40. "\n"\
  41. "CREATE INDEX Member_networkId ON Member (networkId);\n"\
  42. "\n"\
  43. "CREATE UNIQUE INDEX Member_networkId_nodeId ON Member (networkId, nodeId);\n"\
  44. "\n"\
  45. "CREATE TABLE MulticastRate (\n"\
  46. " networkId char(16) NOT NULL,\n"\
  47. " mgMac char(12) NOT NULL,\n"\
  48. " mgAdi integer NOT NULL DEFAULT(0),\n"\
  49. " preload integer NOT NULL,\n"\
  50. " maxBalance integer NOT NULL,\n"\
  51. " accrual integer NOT NULL\n"\
  52. ");\n"\
  53. "\n"\
  54. "CREATE INDEX MulticastRate_networkId ON MulticastRate (networkId);\n"\
  55. "\n"\
  56. "CREATE TABLE Network (\n"\
  57. " id char(16) PRIMARY KEY NOT NULL,\n"\
  58. " name varchar(128) NOT NULL,\n"\
  59. " private integer NOT NULL DEFAULT(1),\n"\
  60. " enableBroadcast integer NOT NULL DEFAULT(1),\n"\
  61. " allowPassiveBridging integer NOT NULL DEFAULT(0),\n"\
  62. " v4AssignMode varchar(8) NOT NULL DEFAULT('none'),\n"\
  63. " v6AssignMode varchar(8) NOT NULL DEFAULT('none'),\n"\
  64. " multicastLimit integer NOT NULL DEFAULT(32),\n"\
  65. " creationTime integer NOT NULL DEFAULT(0),\n"\
  66. " revision integer NOT NULL DEFAULT(1)\n"\
  67. ");\n"\
  68. "\n"\
  69. "CREATE TABLE Node (\n"\
  70. " id char(10) PRIMARY KEY NOT NULL,\n"\
  71. " identity varchar(4096) NOT NULL,\n"\
  72. " lastAt varchar(64),\n"\
  73. " lastSeen integer NOT NULL DEFAULT(0),\n"\
  74. " firstSeen integer NOT NULL DEFAULT(0)\n"\
  75. ");\n"\
  76. "\n"\
  77. "CREATE TABLE Rule (\n"\
  78. " networkId char(16) NOT NULL,\n"\
  79. " nodeId char(10),\n"\
  80. " vlanId integer,\n"\
  81. " vlanPcp integer,\n"\
  82. " etherType integer,\n"\
  83. " macSource char(12),\n"\
  84. " macDest char(12),\n"\
  85. " ipSource varchar(64),\n"\
  86. " ipDest varchar(64),\n"\
  87. " ipTos integer,\n"\
  88. " ipProtocol integer,\n"\
  89. " ipSourcePort integer,\n"\
  90. " ipDestPort integer,\n"\
  91. " \"action\" varchar(4096) NOT NULL DEFAULT('accept')\n"\
  92. ");\n"\
  93. "\n"\
  94. "CREATE INDEX Rule_networkId ON Rule (networkId);\n"\
  95. ""