swreg.inc.php 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <?php
  2. //# DO NOT MODIFY
  3. define('PROVISION_UNKNOWN', -2);
  4. define('PROVISION_IN_PROGRESS', -1);
  5. define('PROVISION_FAIL', 0);
  6. define('PROVISION_SUCCESS', 1);
  7. define('REACHABILITY_NEVER_REACHABLE', 0);
  8. define('REACHABILITY_NOW_UNREACHABLE', 1);
  9. define('REACHABILITY_REACHABLE', 2);
  10. //# END DO NOT MODIFY
  11. // Globals
  12. define('LOGFILE', '/var/log/swreg.log');
  13. define('LOG_LEVEL', 7);
  14. define('TFTPBOOT', '/tftpboot');
  15. define('PORT_TMPL_DIR', TFTPBOOT . '/port-templates');
  16. define('VLAN_TMPL_DIR', TFTPBOOT . '/vlan-templates');
  17. define('DEVICE_TMPL_DIR', TFTPBOOT . '/device-templates');
  18. define('DEVICE_CONFIG_DIR', TFTPBOOT . '/device-configs');
  19. define('DEVICE_TMP_DIR', TFTPBOOT . '/device-tmp');
  20. define('PORT_PROFILE_DIR', TFTPBOOT . '/port-profiles');
  21. define('EEM_TMPL_DIR', TFTPBOOT . '/eem-templates');
  22. define('FPING_PROGRAM', '/usr/local/sbin/fping');
  23. define('USE_PNP', true);
  24. define('EXPORT_PRIME', true);
  25. define('EXPORT_DEADMAN', true);
  26. define('TOOL_NAME', 'CiscoLive Switch Registration Tool');
  27. define('PRIME_CRED_PROFILE', 'CLUS-creds');
  28. define('PRIME_URL', 'https://63.231.220.90');
  29. define('APIC_HOST', 'apic-em.marcuscom.com');
  30. define('DNS_SERVER', '216.206.190.98');
  31. define('DNS_ZONE', 'noc.ciscolive.com');
  32. define('REST_RETRY_INTERVAL', 3);
  33. define('REST_RETRIES', 1);
  34. define('REST_TIMEOUT', 300);
  35. define('DEBUG', 0);
  36. // IPv6 Config
  37. // Whether or not to do IPv6 mapping from IPv4 management address.
  38. define('MAP_V6', false);
  39. // The IPv6 Prefix to use for management.
  40. define('IPV6_PREFIX', '::');
  41. define('IPV6_PREFIXLEN', '64');
  42. define('IPV6_GW', '::');
  43. // Addressing scheme
  44. // Choose one of IDF, NEXT_FREE, or NONE
  45. // IDF : The IDF switch is assumed to be .1 and each switch associated with
  46. // it will match on the first three octets.
  47. // NEXT_FREE : Pick the next free address for a given MDF
  48. // DNS : Do a DNS lookup on the given name and use that IP
  49. // NONE : IP address assignment will be done manually
  50. define('ADDRESS_SCHEME', 'IDF');
  51. // Regexps for Plug'n'Play (PnP) support
  52. // They only matter if the global, USE_PNP
  53. // is set to TRUE.
  54. // OPTIONAL
  55. $PNP_PATTERNS = array(
  56. '15\.2.+E' => true,
  57. );
  58. // The MDFs are L3 domains.
  59. // MANDATORY!
  60. $MDFS = array(
  61. 'HILTON',
  62. 'HYATT',
  63. 'NODE',
  64. 'SDCC',
  65. );
  66. // List all PIDs or PID patterns here.
  67. // MANDATORY!
  68. $ZTP_PIDS = array(
  69. 'WS-C3560CG-8PC-S',
  70. 'WS-C3750X',
  71. );
  72. // Fill in each of these arrays based on the ZTP PIDs listed above.
  73. // MANDATORY!
  74. $IMG_VERS = array(
  75. 'WS-C3560CG-8PC-S' => '15.0(2)SE7',
  76. 'WS-C3750X' => '15.0(2)SE7',
  77. );
  78. $IMG_FILES = array(
  79. 'WS-C3560CG-8PC-S' => 'c3560c405ex-universalk9-mz.150-2.SE7.bin',
  80. 'WS-C3750X' => 'c3750e-universalk9-mz.150-2.SE7.bin',
  81. );
  82. $START_PORTS = array(
  83. 'WS-C3560CG-8PC-S' => '0/1',
  84. 'WS-C3750X' => '1/0/1',
  85. );
  86. $PORT_TYPES = array(
  87. 'WS-C3560CG-8PC-S' => 'GigabitEthernet',
  88. 'WS-C3750X' => 'GigabitEthernet',
  89. );
  90. // End PID arrays
  91. // Fill out PIDs mapping to number of ports.
  92. // MANDATORY!
  93. $PID_PORTS = array(
  94. 'WS-C3560CG-8PC-S' => '8',
  95. 'WS-C3750X-24' => '24',
  96. 'WS-C3750X-48' => '48',
  97. );
  98. // Port patterns
  99. // The patterns that start a port name
  100. // MANDATORY!
  101. $PORT_PATTERNS = array(
  102. 'WS-C3560CG-8PC-S' => '0/',
  103. 'WS-C3750X-24' => '1/0/',
  104. 'WS-C3750X-48' => '1/0/',
  105. );
  106. // Map the PID ports to a ZTP PID
  107. // This is only needed if you don't use fully-qualified
  108. // PIDs in the ZTP PIDs.
  109. // OPTIONAL OBSOLETE!!!
  110. /*$PID_MAP = array(
  111. 'WS-C3750X-24' => 'WS-C3750X',
  112. 'WS-C3750X-48' => 'WS-C3750X',
  113. );*/
  114. // List any aliases here.
  115. // This goes from what the device may report
  116. // to a fully-qualified PID.
  117. $PID_ALIASES = array(
  118. 'WS-C3850-24U' => 'WS-C3850-24U-L',
  119. );
  120. // List any SDM profile preference here.
  121. // The profile will be configured at ZTP time.
  122. // If the PID is not here, no profile will be set.
  123. $SDM_PROFILES = array(
  124. );
  125. // Fill in VLAN mappings
  126. // VLAN macro will be the name with spaces turned to '_' and
  127. // all letters uppercase followed by _VLAN.
  128. // E.g., for NOC Device Mgmt, the macro will be
  129. // %%NOC_DEVICE_MGMT_VLAN%%
  130. // MANDATORY!
  131. $VLANS = array(
  132. 'NOC Device Mgmt' => '100',
  133. 'NOC Wired' => '110',
  134. 'Wireless AP' => '210',
  135. 'Voice TP' => '300',
  136. 'Video Surveillance' => '310',
  137. 'Speaker' => '350',
  138. 'CiscoTV' => '360',
  139. 'CiscoTV DMP' => '370',
  140. 'Session Capture' => '380',
  141. 'Cisco Store' => '390',
  142. 'Registration' => '400',
  143. 'Session Signage' => '420',
  144. 'Labs CCIE' => '500',
  145. 'Labs Testing Center' => '510',
  146. 'Labs Session Labs' => '520',
  147. 'DevNet' => '600',
  148. 'NOC Public' => '751',
  149. 'Registration Public' => '752',
  150. 'SDCC Public' => '753',
  151. 'Labs Public' => '754',
  152. 'CiscoTV Public' => '755',
  153. 'Cisco Campus Public' => '761',
  154. 'Wired NAT' => '2000',
  155. 'NODE Public' => '757',
  156. 'WoS Booths' => '550',
  157. 'WISP Labs' => '530',
  158. 'HILTON Public' => '758',
  159. 'HYATT Public' => '759',
  160. );
  161. // VLAN Overrides
  162. // Fill in any per-MDF VLAN override
  163. // OPTIONAL
  164. /*
  165. $VLAN_OVERRIDES = array(
  166. 'SDCC' => array(
  167. 'CiscoTV Public' => '756',
  168. ),
  169. 'NODE' => array(
  170. 'CiscoTV Public' => '762',
  171. ),
  172. );
  173. */
  174. // Custom Macros
  175. // Put any general custom macros and
  176. // their replacements here. They will
  177. // be converted to %%MACRO_NAME%% and replaced
  178. // in your configs.
  179. // OPTIONAL
  180. $CUSTOM_MACROS = array(
  181. 'MAX_MACS' => '10',
  182. );
  183. // MDF Overrides
  184. // Put macros here that will be replaced
  185. // based on the MDF location
  186. // OPTIONAL
  187. $MDF_OVERRIDES = array(
  188. 'NODE' => array(
  189. 'MAX_MACS' => '100',
  190. ),
  191. );
  192. // PID Macros
  193. // Put macros here mapped to specific PIDs
  194. // PID aliases are considered
  195. // OPTIONAL
  196. $PID_MACROS = array(
  197. 'WS-C3560CG-8PC-S' => array(
  198. 'MAX_MACS' => '5',
  199. ),
  200. );
  201. // Hooks
  202. // Define scripts to call for various events.
  203. // VERIFY (hooks called when a device is verified)
  204. // SUCCESS: Called when a device is successfully verified
  205. // ARGS: <HOOK_NAME> <REMOTE_IP> <CONFIG_FILE> <SERIAL_NO> <IMAGE_MD5> <IMAGE_NAME>
  206. // FAIL : Called when a device fails to verify
  207. // ARGS: <HOOK_NAME> config|image <REMOTE_IP> <CONFIG_FILE> <SERIAL_NO> <IMAGE_MD5> <GOOD_MD5> <IMAGE_NAME>
  208. // REQUEST (hooks called when a device boostrap request is made)
  209. // NEW : Called when a new device request is received
  210. // ARGS: <HOOK_NAME> <REMOTE_IP> <HOSTNAME> <SERIAL_NO> <PID> <VERSION> <NUM_PORTS> <IMAGE_NAME>
  211. // UNKNOWN: Called when a request from an unmapped device is seen
  212. // ARGS: <HOOK_NAME> <REMOTE_IP> <SERIAL_NO> <PID>
  213. // ERROR: Called when a new request cannot be serviced due to an error
  214. // ARGS: <HOOK_NAME> <REMOTE_IP> <SERIAL_NO> <PID> <MSG>
  215. // PINGER (hooks called when a device becomes reachable or unreachable)
  216. // REACHABLE : Called when a device transitions to a reachable state
  217. // ARGS: <HOOK_NAME> <SERIAL_NO> <DEVICE_IP>
  218. // UNREACHABLE: Called when a device transitions to an unreachable state
  219. // ARGS: <HOOK_NAME> <SERIAL_NO> <DEVICE_IP>
  220. // OPTIONAL
  221. $HOOKS = array(
  222. 'VERIFY' => array(
  223. 'SUCCESS' => '',
  224. 'FAIL' => '',
  225. ),
  226. 'REQUEST' => array(
  227. 'NEW' => '',
  228. 'UNKNOWN' => '',
  229. 'ERROR' => '',
  230. ),
  231. 'PINGER' => array(
  232. 'REACHABLE' => '',
  233. 'UNREACHABLE' => '',
  234. ),
  235. );